<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal"
    aria-hidden="true" [config]="{ backdrop: 'static' }" (onHidden)="onHidden($event)" (onShown)="shown()">
    <div class="modal-dialog modal-xxl">
        <div class="modal-content">
            <form #editForm="ngForm" novalidate autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        入库信息
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="m-subheader">
                    <div class="col-11">
                        <div class="row align-items-center">
                            <div class="col-3">
                                <div class="form-group m-form__group row">
                                    <label class="col-5 col-form-label" for="supplierFilter">供货单位:</label>
                                    <div class="col-7">
                                        <input type="text" class="form-control m-input" name="supplierFilter" id="supplierFilter"
                                            [(ngModel)]="supplierFilter" />
                                    </div>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group m-form__group row">

                                    <label class="col-5 col-form-label" style="text-align: right; ">物料编号:</label>
                                    <div class="col-7">
                                        <input [(ngModel)]="f_MaterialCodeFiter" name="f_MaterialCode" #nameInput="ngModel"
                                            class="form-control m-input" type="text" />
                                    </div>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group m-form__group row">

                                    <label class="col-5 col-form-label" style="text-align: right;">物料名称:</label>
                                    <div class="col-7">
                                        <input id="f_MaterialName" #nameInput="ngModel" class="form-control" type="text"
                                            name="f_MaterialName" [(ngModel)]="f_MaterialNameFiter" maxlength="32" />
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-1 m--align-right">
                                    <button (click)="getToolIntoItems()" class="btn btn-primary m--margin-top-40" type="submit">
                                        <i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i>查询
                                    </button>
                                </div>
                        </div>
                   
                    </div>
                </div>
                <div class="modal-body">
                    <div class="m-portlet__body" style="border-top: 1px solid #ebedf2;  margin-top: 11px;">
                        <h4>入库信息</h4>
                        <div class="tabbable-line">
                            <div class="tab-content" style="padding-top:0;">
                                <div class="tab-pane active" id="tab-model">
                                    <div class="row align-items-center">
                                        <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                                            <p-table #dataTable (onLazyLoad)="getRecordsIfNeeds($event)" [value]="primengTableHelper.records"
                                                [rows]="primengTableHelper.defaultRecordsCountPerPage" [paginator]="false"
                                                [lazy]="true" [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                                                [resizableColumns]="primengTableHelper.resizableColumns" [(selection)]="selectedValue"
                                                selectionMode="multiple">
                                                <ng-template pTemplate="header">
                                                    <tr>
                                                        <th style="width: 25px">
                                                            <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
                                                        </th>
                                                        <th style="width: 40px">
                                                            序号
                                                        </th>
                                                        <ng-container *ngFor="let ext of extensions">
                                                            <th width="{{ ext.width }}">
                                                                {{ ext.title }}
                                                            </th>
                                                        </ng-container>
                                                    </tr>
                                                </ng-template>

                                                <ng-template pTemplate="body" let-record="$implicit" let-i="rowIndex">
                                                    <tr [pSelectableRow]="record">
                                                        <td style="width: 25px">
                                                            <p-tableCheckbox [value]="record"></p-tableCheckbox>
                                                        </td>
                                                        <td style="width: 40px">
                                                            {{ i + 1 + paginator.first }}
                                                        </td>
                                                        <ng-container *ngFor="let ext of extensions">
                                                            <ng-container [ngSwitch]="ext.formatType">
                                                                <ng-container *ngSwitchCase="1">
                                                                    <td width="{{ ext.width }}">
                                                                        {{ record[ext.key] | number: '1.0-0' }}
                                                                    </td>
                                                                </ng-container>
                                                                <ng-container *ngSwitchCase="2">
                                                                    <td width="{{ ext.width }}">
                                                                        {{ record[ext.key] | number: '1.2-2' }}
                                                                    </td>
                                                                </ng-container>
                                                                <ng-container *ngSwitchCase="4">
                                                                    <td width="{{ ext.width }}">
                                                                        {{
                                                                        record[ext.key] | momentFormat: 'YYYY-MM-DD'
                                                                        }}
                                                                    </td>
                                                                </ng-container>
                                                                <ng-container *ngSwitchDefault>
                                                                    <td width="{{ ext.width }}" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">
                                                                        {{ record[ext.key] }}
                                                                    </td>
                                                                </ng-container>
                                                            </ng-container>
                                                        </ng-container>
                                                    </tr>
                                                </ng-template>
                                            </p-table>

                                            <div class="primeng-paging-container">
                                                <p-paginator [rows]="20" #paginator (onPageChange)="getRecordsIfNeeds($event)"
                                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                                    [rowsPerPageOptions]="
                                                        primengTableHelper.predefinedRecordsCountPerPage
                                                    ">
                                                </p-paginator>
                                                <span class="total-records-count">
                                                    {{ l('TotalRecordsCount', primengTableHelper.totalRecordsCount) }}
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">
                            {{ l('Cancel') }}
                        </button>
                        <button (click)="save()" type="button" class="btn btn-primary blue" [disabled]="!editForm.form.valid"
                            [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')">
                            <i class="fa fa-save"></i>
                            <span>{{ l('Save') }}</span>
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>